package com.chainyoung.component_tmperson.ui.mvp.presenter;


import com.chainyoung.common.base.CommonSubscriber;
import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.integration.IRepositoryManager;
import com.chainyoung.common.mvp.BaseModel;
import com.chainyoung.common.mvp.BasePresenter;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.api.PersonService;
import com.chainyoung.component_tmperson.entity.InviteFriend;
import com.chainyoung.component_tmperson.ui.mvp.contract.FeedBackContract;
import com.chainyoung.component_tmperson.ui.mvp.contract.InviteFriendContract;

import java.util.TreeMap;

import javax.inject.Inject;

import io.reactivex.Flowable;

@ActivityScope
public class FeedBackPresenter extends BasePresenter<FeedBackContract.Model, FeedBackContract.View> {

    @Inject
    public FeedBackPresenter(FeedBackContract.Model model, FeedBackContract.View rootView) {
        super(model, rootView);
    }


    public void feedBack(TreeMap<String, Object> map) {
        addSubscribe(mModel.feedBack(map)
                .compose(RxUtils.<String>rxSchedulerHelper())
                .subscribeWith(new CommonSubscriber<String>(mView,true) {
                    @Override
                    public void onNext(String object) {
                        mView.onFeedBackSuccess(object);
                    }

                    @Override
                    public void onError(Throwable e) {
                        super.onError(e);
                    }
                }));
    }


}

